# coding = utf-8
from django.urls import path
from rest_framework.routers import DefaultRouter
from .views import UserInfoViewSet, UserInfoReadOnlyViewSet, RoleViewSet, PermissionViewSet, JSONWebTokenAPIView, \
    RolePermsViewSet, RoleListViewSet, PasswordChangeAPIView, ImageUploadAPIView, UserLogoutAPIView, \
    UserLogViewSet, PasswdChangeAPIView, UserInfoListAPIView

router = DefaultRouter()
router.register(r'user', UserInfoViewSet, basename="user")
router.register(r'role', RoleViewSet, basename="role")
router.register(r'role_list', RoleListViewSet, basename="role-list")
router.register(r'perm', PermissionViewSet, basename="perm")
router.register(r'role_perms', RolePermsViewSet, basename="role-perms")
router.register(r'user_log', UserLogViewSet, basename="user-log")

urlpatterns = [
    path('login/', JSONWebTokenAPIView.as_view(), name="api-user-login"),
    path('logout/', UserLogoutAPIView.as_view(), name="api-user-logout"),
    path('user_info/', UserInfoReadOnlyViewSet.as_view(), name="api-user-info"),
    path('user_list/', UserInfoListAPIView.as_view(), name="api-user-list"),
    path('password/', PasswordChangeAPIView.as_view(), name="api-password-change"),
    path('passwd/', PasswdChangeAPIView.as_view(), name="api-password-update"),
    path('image_upload/', ImageUploadAPIView.as_view(), name="api-image-upload"),
]

urlpatterns += router.urls